<script>
	import {
		computed,
		toRefs
	} from 'vue'
	import Upgrade from '@/common/Upgrade.js'
	import {
		userInfo
	} from '@/store/Pinia/userInfo.js'

	import {
		time
	} from '@/store/Pinia/time.js'
	import {
		getLatestVersion
	} from "@/api/systemInfo/index.js";
	import akicryptojs from '@/uni_modules/aki-cryptojs/js_sdk/aki-cryptojs'
	// import {
	// 	EncryptAES,
	// 	DecryptAES
	// } from "@/common/Func.js"

	const upgradeInstance = new Upgrade();
	export default {
		data() {
			return {
				timeDate: time(),
				upgrade: new Upgrade()
			};
		},
		methods: {
			getTime() {
				setTimeout(() => {
					this.timeDate.data = new Date();
					this.getTime()
				}, 1000);
			},
			checkUpgrade() {
				upgradeInstance.checkVersion()
			},

			// Encrypt() {
			// 	const code = EncryptAES('tenant_id_KJRZ001')
			// 	let codes = DecryptAES(code)
			// 	console.log('KJRZ001的编码为', code)
			// }
		},
		onLaunch: function() {
			uni.getSystemInfo({
			  success: function (info) {
				console.log(info)
				uni.setStorageSync('deviceId', info.deviceId)
			    console.log('窗口宽度: ' + info.windowWidth);
			    console.log('窗口高度: ' + info.windowHeight);
			  }
			});
			if (!uni.getStorageSync('activeState')) {
				uni.setStorageSync('activeState', 'off')
			}
			// this.Encrypt()
			// #ifdef APP-PLUS
			// 隐藏顶部电池,时间等信息 
			plus.navigator.setFullscreen(true);
			plus.screen.lockOrientation('landscape-primary')
			//隐藏虚拟按键
			plus.navigator.showSystemNavigation()
			setTimeout(() => {
				plus.navigator.hideSystemNavigation() //隐藏虚拟按键
				plus.navigator.showSystemNavigation()
			}, 2500)
			this.checkUpgrade()
			// #endif
			console.log('App Launch')
			const custHeight = computed(() => {
				let systemInfo = uni.getSystemInfoSync()
				return function() {
					return systemInfo.screenHeight - systemInfo.windowTop
				}
			})
			this.getTime()
			
			
			uni.addInterceptor('navigateTo', { //监听跳转
				success(e) {
					
				}
			})
		},
		onShow: function() {},
		onHide: function() {
			console.log('App Hide')
		},
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-plus/index.scss";
	@import '@/static/css/index.scss';

	uni-page-body,
	html,
	body {
		height: 100%;
	}

	page {
		background-color: #edf2fa;
	}

	/* 加载框架核心样式 */
	@import "./Grace6/css/grace.scss";
	/* 加载深色模式适配样式 */
	// @import "./Grace6/css/graceDark.scss";
	/* 加载自定义样式 */
	@import "./custom/custom.scss";

	/* 加载图标字体 - 条件编译模式 */
	/* #ifdef APP-PLUS-NVUE */
	.gui-icons {
		font-family: graceIconfont;
	}

	/* #endif */
	/* #ifndef APP-NVUE */
	/* #endif */
</style>